import React from 'react';
import { renderRouter, RouterConfg } from '@/router/router';
import { useSelector, shallowEqual, useDispatch } from 'react-redux';

import { RootState } from '@/store/rootReducer';
import {actions} from '@/store/modules/document/document';


export default function Test(props: { routers: RouterConfg | RouterConfg[] }) {
  const dispatch = useDispatch();

  const CounterReducer = useSelector(
    (state: RootState) => state.CounterReducer,
    shallowEqual
  );

  function clickMe() {
    dispatch(actions.fetchWorkspaceList());
  }

  return (
    <div>
      App-35----------
      <div className="abc" onClick={clickMe}>
        点击我
      </div>
      {JSON.stringify(CounterReducer)}
      {renderRouter(props.routers)}
    </div>
  );
}
